package com.zl.smartmall.library.po;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class CustomerServiceInfo {

	private int uid;
	private int gender;
	private String face;
	private String nickname;

	public int getUid() {
		return uid;
	}

	public void setUid(int uid) {
		this.uid = uid;
	}

	public int getGender() {
		return gender;
	}

	public void setGender(int gender) {
		this.gender = gender;
	}

	public String getFace() {
		return face;
	}

	public void setFace(String face) {
		this.face = face;
	}

	public String getNickname() {
		return nickname;
	}

	public void setNickname(String nickname) {
		this.nickname = nickname;
	}
	
	public static List<CustomerServiceInfo> parse(JSONArray jsonArray) throws JSONException {
		List<CustomerServiceInfo> list = new ArrayList<CustomerServiceInfo>();
		for(int i = 0; jsonArray != null && i < jsonArray.length(); i++) {
			CustomerServiceInfo model = parse(jsonArray.getJSONObject(i));
			if(model != null) {
				list.add(model);
			}
		}
		return list;
	}
	
	public static CustomerServiceInfo parse(JSONObject jsonObject) throws JSONException {
		CustomerServiceInfo model = null;
		if(jsonObject != null && jsonObject.length() > 0) {
			model = new CustomerServiceInfo();
			model.face = jsonObject.getString("face");
			model.nickname = jsonObject.getString("nickname");
			model.uid = jsonObject.getInt("uid");
		}
		
		return model;
	}

}
